from manim import *

class RotationUpdater(Scene):
    def construct(self):
        def update_forth(mobj, dt):
            """ 
            mobj 对象
            dt 时间间隔
            """
            mobj.rotate_about_origin(dt)

        def update_back(mobj, dt):
            mobj.rotate_about_origin(-dt)

        l1 = Line(ORIGIN, LEFT).set_color(BLUE)
        l2 = Line(ORIGIN, LEFT).set_color(GREEN)
        self.add(l1, l2)
        
        # 1.逆时针旋转
        l2.add_updater(update_forth)
        self.wait(10)
        l2.remove_updater(update_forth)
        
        # 2.顺时针旋转
        l2.add_updater(update_back)
        self.wait(10)
        l2.remove_updater(update_back)
        self.wait(2)
        